import 'package:json_annotation/json_annotation.dart';
part 'financial_summary.g.dart';

@JsonSerializable()
class FinancialSummary {
  final String companyName;
  final int year;
  final double totalProfit;
  final double totalIncome;
  final double totalExpense;
  final List<OtherItem> otherItems;
  final InvoiceData invoiceData;

  FinancialSummary({
    required this.companyName,
    required this.year,
    required this.totalProfit,
    required this.totalIncome,
    required this.totalExpense,
    required this.otherItems,
    required this.invoiceData,
  });

  factory FinancialSummary.fromJson(Map<String, dynamic> json) => _$FinancialSummaryFromJson(json);
  Map<String, dynamic> toJson() => _$FinancialSummaryToJson(this);
}

@JsonSerializable()
class OtherItem {
    String title;
    double amount;
  OtherItem({required this.title, required this.amount});
  factory OtherItem.fromJson(Map<String, dynamic> json) => _$OtherItemFromJson(json);
  Map<String, dynamic> toJson() => _$OtherItemToJson(this);
}

@JsonSerializable()
class InvoiceData {
  final int salesCount;
  final double salesAmount;
  final int purchaseCount;
  final double purchaseAmount;
  InvoiceData({required this.salesCount, required this.salesAmount, required this.purchaseCount, required this.purchaseAmount});
  factory InvoiceData.fromJson(Map<String, dynamic> json) => _$InvoiceDataFromJson(json);
  Map<String, dynamic> toJson() => _$InvoiceDataToJson(this);
}